/*****************************************************
*         Università degli Studi di Cagliari         *
*                                                    *
*  Algoritmi e Strutture Dati 2 - Progetto mid-term  *
*                                                    *
*  Riccardo Scateni    (riccardo@unica.it)           *
*  Stefano Marras      (stefano.marras@unica.it)     *
*  Marco Livesu        (marco.livesu@unica.it)       *
******************************************************/

#ifndef CORE_H
#define CORE_H

#include <float.h>

#include <QFile>
#include <QFileInfo>
#include <QFileDialog>
#include <QStringList>

#include <OpenMesh/Tools/Utils/Timer.hh>

#include "../definitions.h"
#include "../quadric.h"

class Core : public QObject
{

        Q_OBJECT


        public:


                Core() {}




        public
        slots:


                void open_file ( void );

                inline int nMeshes() { return mesh.size(); }

                void meanCurvature();

                void GaussianCurvature();




        signals:


                // please emit this signal each time any mesh have been modified.
                // no visual update will occur until such signal will be emitted
                //
                void updateMeshList(QVector<MyMesh*> *mesh);




        protected:


                void loadMesh(QString filename);

                void setRandomVertexColor(MyMesh *m);

                void setRandomFaceColor(MyMesh *m);

                void setRandom1DTextCoord(MyMesh *m);

                void generateSpherical2DTextureMapping(MyMesh *m);

                OpenMesh::EPropHandleT<MyMesh::Scalar> request_CotagentWeights(MyMesh *m);

                OpenMesh::VPropHandleT<MyMesh::Scalar> request_VoronoiArea(MyMesh *m);

                OpenMesh::VPropHandleT<MyMesh::Scalar> request_meanCurvature(MyMesh *m);

                OpenMesh::VPropHandleT<MyMesh::Scalar> request_GaussianCurvature(MyMesh *m);




        private:


                QVector<MyMesh*> mesh;
};

#endif // CORE_H
